﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Medianamik.UI.ImportExportManagement
{
    public class RecordTypeProperty
    {
        public RecordTypeProperty(RecordType recordType, String name, SQLDataType sqlDataType)
        {
            if (String.IsNullOrEmpty(name))
                throw new ArgumentException("The name of a Record Type Property cannot be null or empty.", "name");

            if (sqlDataType == null)
                throw new ArgumentNullException("sqlDataType");

            if (recordType == null)
                throw new ArgumentNullException("recordType");

            _name = name;
            _sqlDataType = sqlDataType;
            _recordType = recordType;
        }

        public RecordTypeProperty(RecordType recordType, String name, SQLDataType sqlDataType, Guid id)
            : this(recordType, name, sqlDataType)
        {
            Id = id;
        }

        public Guid? Id { get; set; }

        public String Name
        {
            get { return _name; }
            set
            {
                if (String.IsNullOrEmpty(value))
                    throw new ArgumentException("The name of a Record Type Property cannot be null or empty.", "Name");

                _name = value;
            }
        }
        string _name;

        public RecordType RecordType
        {
            get { return _recordType;}
        }
        RecordType _recordType;

        public SQLDataType SQLDataType
        {
            get { return _sqlDataType; }
        }
        SQLDataType _sqlDataType;
    }
}
